<?php
if (!defined('BASEPATH')) {
	exit('No direct script access allowed');
}

class M_kontak extends CI_Model {

	public function __construct() {
		parent::__construct();
	}

	function get() {
		$sql = 'SELECT * FROM kontak';
		return $sql;
	}

	function get_by($params) {
		$sql = 'SELECT * FROM kontak WHERE id_kontak = ?';
		$query = $this->db->query($sql, $params);
		if ($query->num_rows() > 0) {
			$result = $query->row_array();
			$query->free_result();
		} else {
			$result = array();
		}
		return $result;
	}

	function update($id_berita, $dataUpdate) {
		$this->db->where('id_kontak', $id_berita);
		$update = $this->db->update('kontak', $dataUpdate);
		return $update;
	}
}
